<template>
  <div class="page-content">
    <a-card
      style="width: 100%; height: 100%"
      :bodyStyle="{ padding: 0, height: 'calc(100% - 1px)' }"
    >
      <iframe
        v-if="show"
        class="content"
        :src="src"
        frameborder="0"
        style="width: 100%; height: calc(100% - 1px)"
      />
      <a-empty v-else />
    </a-card>
  </div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { getIMAccount } from '@/api/index'

const show = ref(false)
const src = ref('')

onMounted(() => {
  const base = 'http://localhost:8898/'
  // const appkey = '38bc2cc3c1383f7d6d45014594232b11'
  getIMAccount().then((res) => {
    // console.log(res.data)
    if (res.data) {
      show.value = true
      src.value = `${base}?appkey=${res.data.appId}&account=${res.data.accid}&token=${res.data.token}`
    } else {
      show.value = false
    }
  })
  // const appkey = 'd65f42cef28af7a9d9c27a8f6bebcdb1'
  // const account = '10001'
  // const toke = '123456'
})

onUnmounted(() => {
  show.value = false
})
</script>
<style lang="less" scoped></style>
